Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 31, 2025

This PR implements visual indicators to distinguish between global and project-level custom modes in the mode selector, addressing issue #6502.

Changes Made

UI Enhancements

  • Mode Dropdown: Added short indicators (G) and (P) next to custom mode names in the dropdown list
  • Selected Mode Button: Show (Global) or (Project) text next to the selected custom mode name
  • Built-in Mode Handling: Only custom modes show source indicators; built-in modes remain unchanged

Implementation Details

  • Added helper functions getModeSource() and getSourceDisplayText() to determine and format mode source indicators
  • Imported isCustomMode function from @roo/modes to identify custom modes
  • Used existing source field from CustomModesManager which already tracks "global" vs "project" origin

Internationalization

  • Added translation keys for source indicators in multiple languages:
    • modeSelector.global / modeSelector.project (full text)
    • modeSelector.globalShort / modeSelector.projectShort (abbreviated)
  • Implemented in English, French, Spanish, and German locales

Testing

  • Added comprehensive test coverage for the new functionality
  • Tests verify indicators appear for custom modes but not built-in modes
  • Tests check both dropdown list and selected mode button display

User Experience

  • Clear Distinction: Users can now easily identify whether a custom mode is global (affects all projects) or project-specific
  • Minimal Visual Impact: Indicators use muted text color (text-vscode-descriptionForeground) to avoid UI clutter
  • Consistent Design: Follows existing VSCode design patterns and color schemes

Acceptance Criteria Met

✅ Show "(G)" next to global custom modes in dropdown
✅ Show "(P)" next to project custom modes in dropdown
✅ Built-in modes show no indicator
✅ Selected mode button shows full "(Global)" or "(Project)" text
✅ Indicators use muted text color
✅ No visual clutter introduced

Fixes #6502


Important

Add visual indicators for global and project custom modes in the mode selector with UI updates, helper functions, and internationalization.

  • UI Enhancements:
    • ModeSelector.tsx: Added indicators (G) and (P) for global and project custom modes in dropdown and full text in selected mode button.
    • Built-in modes remain unchanged.
  • Implementation Details:
    • Added getModeSource() and getSourceDisplayText() functions to determine and format mode source indicators.
    • Used isCustomMode from @roo/modes to identify custom modes.
    • Utilized source field from CustomModesManager for mode origin.
  • Internationalization:
    • Added translation keys for source indicators in multiple languages in chat.json files.
  • Testing:
    • Added tests in ModeSelector.spec.tsx to verify indicators for custom modes and absence for built-in modes.
    • Tests cover both dropdown and selected mode button displays.

This description was created by Ellipsis for 3575d87. You can customize this summary. It will automatically update as commits are pushed.

…elector

- Add (G)/(P) indicators in mode dropdown list for custom modes
- Show (Global)/(Project) text in selected mode button
- Add helper functions to determine mode source and display text
- Add translation keys for global/project indicators in EN, FR, ES, DE
- Add comprehensive tests for new functionality
- Only show indicators for custom modes, not built-in modes

Fixes #6502
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 31, 2025 19:23
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused labels Jul 31, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I've reviewed the changes and found that the implementation effectively addresses the requirements from issue #6502. The code is clean and well-structured with good test coverage. I have some suggestions for improvement, particularly around internationalization completeness.

"global": "Global",
"project": "Project",
"globalShort": "G",
"projectShort": "P"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR only adds translations for 4 languages (en, fr, es, de) but the codebase supports 18 languages total. The missing translations for the other 14 languages (ca, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW) could cause the mode source indicators to display as untranslated keys like "chat:modeSelector.global" for users of those languages. Could we add translations for all supported languages to ensure a consistent experience for all users?

const SEARCH_THRESHOLD = 6

// Helper function to get the source of a custom mode
function getModeSource(mode: ModeConfig, customModes?: ModeConfig[]): "global" | "project" | null {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider defining a type or enum for mode source values instead of using string literals "global" | "project" throughout the code. This would improve type safety and maintainability. For example:

expect(trigger.textContent).not.toContain("(Global)")
expect(trigger.textContent).not.toContain("(Project)")
})
})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding test cases for edge scenarios:

  • What happens when a custom mode has no source field (should default to "global" as per the implementation)
  • Behavior when customModes array is undefined or null
  • Ensuring the source indicator styling works correctly in both light and dark themes

These tests would help ensure robustness of the feature.

<span className="truncate">
{selectedMode?.name || ""}
{selectedModeSourceText && (
<span className="text-vscode-descriptionForeground ml-1">({selectedModeSourceText})</span>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The source indicator rendering logic is duplicated between the trigger button (lines 211-213) and dropdown items (lines 282-286). Consider extracting this into a small component for better reusability and consistency. For example:

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 31, 2025
- Add global, project, globalShort, projectShort keys to all 18 locale files
- Supports visual indicators for custom mode sources in ModeSelector
- Completes internationalization for issue #6502
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Aug 1, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Aug 1, 2025
@daniel-lxs
Copy link
Member

This doesn't look good, closing for now

@daniel-lxs daniel-lxs closed this Aug 5, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Aug 5, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add visual indicator to show if a mode is global or project-based in the mode edit screen

4 participants